Maxsize = 100


class sqqueue:
    def __init__(self, n=Maxsize):
        self.elem = [0] * n
        self.front = self.rear = 0

    # 判断是否队满
    def full(self):
        return (self.rear + 1) % Maxsize == self.front

    # 判断队空
    def empty(self):
        return self.rear == self.front

    # 取对头元素
    def getfront(self):
        return self.elem[self.front]

    # 置空队列
    def setempty(self):
        self.front = self.rear = 0

    # 入队操作
    def push(self, e):
        if self.full():
            return False
        self.elem[self.rear] = e
        self.rear = (self.rear + 1) % Maxsize

    # 出队操作
    def pop(self):
        if self.empty():
            return False
        self.front = (self.front + 1) % Maxsize
        return True

    # 遍历操作
    def output(self):
        if self.empty():
            return False
        while not self.empty():
            print(self.getfront(), end="")
            self.pop()
            print('')


a = sqqueue()
for i in [1, 23, 1, 3, 1, 53, 5, 34, 6, 43, 532, 32]:
    a.push(i)
a.output()
